package cn.znzz.cjm.mapper;

import cn.znzz.cjm.domain.Employee;
import cn.znzz.cjm.util.AjaxResult;
import cn.znzz.cjm.vo.UserInfo;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author chenjiangmin
 * @since 2021-12-15
 */
public interface EmployeeMapper extends BaseMapper<Employee> {

    @Select("SELECT\n" +
            "\tt1.company_name companyName,\n" +
            "\tt1.id tid,\n" +
            "\tt2.username empName \n" +
            "FROM\n" +
            "\tt_tenant t1\n" +
            "\tLEFT JOIN t_employee t2 ON t1.admin_id = t2.id \n" +
            "WHERE\n" +
            "\tt2.login_id = #{id}")
    UserInfo findUserInfo(Long id);
}
